"use strict";

(function() {
	if (!alx.lj.selectionModes) alx.lj.selectionModes = {};
	
	alx.lj.selectionModes.Lasso = function (args) {
		alx.lj.inherit(this, alx.lj.selectionModes.ISelectionMode);
		
		var me   = this,
				startPos  = null,
				lastPos  = null,
				poly = null,
				prefs = alx.lj.prefs;
		
		var init = function () {
			var svgArgs = {
				"fill":             prefs.visual.fillColor(),
				"stroke":           prefs.visual.strokeColor(),
				"stroke-width":     prefs.visual.strokeWidth(),
				"stroke-linecap":   prefs.visual.strokeLineCap(),
				"stroke-linejoin":  prefs.visual.strokeLineJoin(),
				"stroke-dasharray": prefs.visual.strokeDashArray()
			};
			
			poly = new alx.svg.Polyline(svgArgs);
			args.canvas.append(poly);
		};
		
		// ISelectionMode methods -----------------------------------------
		me.selectionStart = function (pos) {
			startPos = pos;
			poly.addPoint(pos);
		};
		
		me.selectionContainsPoint = function (point) {
			
		};
		
		me.selectionContainsBox = function (box) {
			
		};
		
		me.setSelectables = function (sel) {
			
		};
		
		me.selectionStop = function (x,y) {
			
		};
		
		me.handlePosition = function (pos) {
			lastPos = pos;
			poly.addPoint(pos);
		};
		
		// ---------------------------------------------------------------
		init();
	};
})();